package com.atguigu.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.Date;

@ApiModel(value = "Scores对象", description = "考试成绩")
@Data
@Accessors(chain = true)
@NoArgsConstructor
public class Scores {

    @ApiModelProperty(value = "学生id", position = 1)
    @TableId(type = IdType.INPUT)
    private Integer studentId;

    @ApiModelProperty(value = "课程id", position = 2)
    @TableId(type = IdType.INPUT)
    private Integer courseId;

    @ApiModelProperty(value = "成绩", position = 3)
    private Integer score;

    @ApiModelProperty(value = "创建时间", hidden = true)
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "修改时间", hidden = true)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @ApiModelProperty(value = "版本号", hidden = true)
    @Version
    @TableField(fill = FieldFill.INSERT)
    private Integer version;

    @ApiModelProperty(value = "逻辑删除，1(true)已删除，0(false)未删除", hidden = true)
    @TableLogic
    private Boolean deleted;

    public Scores(Integer studentId, Integer courseId, Integer score) {
        this.studentId = studentId;
        this.courseId = courseId;
        this.score = score;
    }
}
